package com.geeker.module.sys.role.controller;

import com.geeker.common.api.CommonResult;
import com.geeker.common.util.PageUtil;
import com.geeker.module.sys.role.domain.SysRole;
import com.geeker.module.sys.role.dto.SysRoleDto;
import com.geeker.module.sys.role.sevice.SysRoleService;
import com.mybatisflex.core.paginate.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name  = "角色管理")
@RequestMapping("/sys/role")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @Operation(summary = "分页")
    @PostMapping("/page")
    public CommonResult<Page<SysRole>> page(@RequestBody SysRoleDto dto) {
        Page<SysRole> page = PageUtil.getPage(dto);
        Page<SysRole> iPage = sysRoleService.page(page);
        return CommonResult.success(iPage);
    }
}
